package com.ruoyi.web.document;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.document.domain.DocHighBank;
import com.ruoyi.document.service.IDocHighBankService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 高级题管理Controller
 *
 * @author tom
 * @date 2024-12-04
 */
@RestController
@RequestMapping("/document/highbank")
public class DocHighBankController extends BaseController
{
    @Autowired
    private IDocHighBankService docHighBankService;

    /**
     * 查询高级题管理列表
     */
    @PreAuthorize("@ss.hasPermi('document:highbank:list')")
    @GetMapping("/list")
    public TableDataInfo list(DocHighBank docHighBank)
    {
        startPage();
        List<DocHighBank> list = docHighBankService.selectDocHighBankList(docHighBank);
        return getDataTable(list);
    }

    /**
     * 导出高级题管理列表
     */
    @PreAuthorize("@ss.hasPermi('document:highbank:export')")
    @Log(title = "高级题管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DocHighBank docHighBank)
    {
        List<DocHighBank> list = docHighBankService.selectDocHighBankList(docHighBank);
        ExcelUtil<DocHighBank> util = new ExcelUtil<DocHighBank>(DocHighBank.class);
        util.exportExcel(response, list, "高级题管理数据");
    }

    /**
     * 获取高级题管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('document:highbank:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(docHighBankService.selectDocHighBankById(id));
    }

    /**
     * 新增高级题管理
     */
    @PreAuthorize("@ss.hasPermi('document:highbank:add')")
    @Log(title = "高级题管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DocHighBank docHighBank)
    {
        return toAjax(docHighBankService.insertDocHighBank(docHighBank));
    }

    /**
     * 修改高级题管理
     */
    @PreAuthorize("@ss.hasPermi('document:highbank:edit')")
    @Log(title = "高级题管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DocHighBank docHighBank)
    {
        return toAjax(docHighBankService.updateDocHighBank(docHighBank));
    }

    /**
     * 删除高级题管理
     */
    @PreAuthorize("@ss.hasPermi('document:highbank:remove')")
    @Log(title = "高级题管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(docHighBankService.deleteDocHighBankByIds(ids));
    }

}
